home *** CD-ROM | disk | FTP | other *** search
- /*
- HEADER: CUG241;
- TITLE: Inference Engine for Expert System;
- DATE: 12/30/85;
- VERSION:
- DESCRIPTION: "Source code for inference engine for an Expert System.";
- KEYWORDS: Artificial Intelligence, expert systems, inference engine;
- SYSTEM: MS-DOS or UNIX System V;
- FILENAME: WEKNOW.C;
- WARNINGS: "User-supported, non-commercial"
- AUTHORS: George Hageman;
- COMPILERS: Microsoft C V3.00 or UNIX System V Portable C Compiler;
- REFERENCES: ;
- ENDREF
- */
-
- /*****************************************************************
- ** **
- ** Inference -- (C) Copyright 1985 George Hageman **
- ** **
- ** user-supported software: **
- ** **
- ** George Hageman **
- ** P.O. Box 11234 **
- ** Boulder, Colorado 80302 **
- ** **
- *****************************************************************/
-
- /*****************************************************************
- **
- ** weKnow(antecedent,&predicate)
- **
- ** routines searches both knownTrue and knownFalse
- ** stacks to determine whether the antecedent is known.
- **
- ** the return value of the routine is TRUE if known and FALSE otherwise
- **
- ** the predicate is set to the "true" value of the antecedent according
- ** to whether its phase is TRUE or FALSE and its .flag indicator.
- **
- *****************************************************************/
-
- #include "expert.h"
- #include "inference.h"
-
- int weKnow(antecedent,p_value)
- int antecedent,*p_value ;
- {
- if(known(antecedent,knownTrue,numTrue) == TRUE )
- switch(ruleBuff[antecedent].flag)
- {
- case STRING_TRUE:
- case STRING_TRUE_HYP:
- case ROUTINE_TRUE:
- case ROUTINE_TRUE_HYP:
- *p_value = TRUE ;
- return(TRUE) ;
- case STRING_FALSE:
- case ROUTINE_FALSE :
- *p_value = FALSE ;
- return(TRUE) ;
- }
- if(known(antecedent,knownFalse,numFalse) == TRUE )
- switch(ruleBuff[antecedent].flag)
- {
- case STRING_TRUE:
- case STRING_TRUE_HYP:
- case ROUTINE_TRUE:
- case ROUTINE_TRUE_HYP :
- *p_value = FALSE ;
- return(TRUE) ;
- case STRING_FALSE:
- case ROUTINE_FALSE:
- *p_value = TRUE ;
- return(TRUE) ;
- }
- return(FALSE) ;
- }
-